<template>
	<view class="position-model-main">
		<view class="common-tips-box">
			<view class="t1">选择行业</view>
			<view class="t2">选择您所期望的行业</view>
		</view>
		<view class="list-box">
			<view class="list-item" v-for="(item, index) in detail" :key='index'>
				<view class="title" @click="handleShowDtlList(index)">
					{{item.name}}
					<text :class="{'pull-right iconfontPT': true, 'iconup': item.rank == 1, 'icondown1': item.rank !== 1}"></text>
				</view>
				<view class="dtl-item" v-if="item.rank == 1">
					<view class="levelModel-box" v-for="(item1, index1) in item.subLevelModelList" :key="index1" @click="handleCheckIndustry(item1.name)">{{item1.name}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		wxGetIndustryConfig,
	} from '../../../apis/recruit/index.js'
	export default {
		data() {
			return {
				detail: []
			}
		},
		onLoad(options) {
			let _this = this;
			wxGetIndustryConfig().then(res => {
				_this.detail = res.data
			})
		},
		methods: {
			handleShowDtlList(i) {
				this.detail[i].rank = this.detail[i].rank == 0 ? 1 : 0;
			},
			handleCheckIndustry(name) {
				let pages = getCurrentPages();
				let prevPage = pages[pages.length - 2]; //-2为上一级页面  
				prevPage.$vm.detail.industry = name

				uni.navigateBack({
					delta: 1 // delta: 1返回上一级（A 页面）    delta: 2返回上两级
				})
			}
		}
	}
</script>

<style lang="less">
	.common-tips-box,
	.list-box {
		padding-left: 30rpx;
		padding-right: 30rpx;
		color: #333;
	}

	.list-box {
		margin-top: 60rpx;
		border-top: 1rpx solid #BDBDBD;
	}

	.list-item {
		padding: 30rpx 0 40rpx;
		font-size: 28rpx;
		border-bottom: 1rpx solid #ccc;
	}

	.levelModel-box {
		padding: 15rpx 30rpx;
		font-size: 24rpx;
		background: #f8f8f8;
		margin: 20rpx 20rpx 0 0;
		display: inline-block;
		vertical-align: top;
	}
</style>
